/*
 * OrderInfo.java
 *
 * Created on April 15, 2007, 10:13 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package usyd.comp5348;

import java.io.Serializable;
import java.util.Date;

/**
 *
 * @author david
 */
public class OrderInfo implements Serializable {
    public static final int UNDEFINED = -1;
    
    private int id;                  // unique order record id
    private int customerId;          // who is ordering them
    private float total;             // cost of order
    private OrderLineInfo[] videos;  // videos being ordered
    private Date orderDate;          // when order was placed
    private String warehouse;        // warehouse handling order
    private String store;            // store where was placed
    private int status;	    // status of order
    public static final int PENDING = 0;
    public static final int SUBMITTED = 0;
    public static final int ACCEPTED = 0;
    public static final int DELIVERED = 0;
    
    public OrderInfo(int customerId, float total, OrderLineInfo[] videos, Date orderDate, String warehouse, int status) {
        this(UNDEFINED, customerId, total, videos, orderDate, warehouse, null, status);
    }
    
    public OrderInfo(int id, int customerId, float total, OrderLineInfo[] videos, Date orderDate, String warehouse, String store, int status) {
        this.setId(id);
        this.setCustomerId(customerId);
        this.setTotal(total);
        this.setVideos(videos);
        this.setOrderDate(orderDate);
        this.setWarehouse(warehouse);
        this.setStore(store);
        this.setStatus(status);
        if (this.getVideos()!=null) {
            for (OrderLineInfo line : this.getVideos()) {
                line.setOrderInfo(this);
            }
        }
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getCustomerId() {
        return customerId;
    }

    public void setCustomerId(int customerId) {
        this.customerId = customerId;
    }

    public float getTotal() {
        return total;
    }

    public void setTotal(float total) {
        this.total = total;
    }

    public OrderLineInfo[] getVideos() {
        return videos;
    }

    public void setVideos(OrderLineInfo[] videos) {
        this.videos = videos;
    }

    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    public String getWarehouse() {
        return warehouse;
    }

    public void setWarehouse(String warehouse) {
        this.warehouse = warehouse;
    }

    public String getStore() {
        return store;
    }

    public void setStore(String store) {
        this.store = store;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
}
